package company.kedaxunfei;

import java.util.Scanner;

public class Ke3A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt();
        int y1 = sc.nextInt();
        int x2 = sc.nextInt();
        int y2 = sc.nextInt();

        int x3 = sc.nextInt();
        int y3 = sc.nextInt();
        int x4 = sc.nextInt();
        int y4 = sc.nextInt();

        if (Math.abs((x1 + x2) / 2 - (x3 + x4) / 2) < ((x2 + x4 - x1 - x3) / 2) && Math.abs((y1 + y2) / 2 - (y3 + y4) / 2) < ((y2 + y4 - y1 - y3) / 2))
            System.out.println(1);
        else
            System.out.println(-1);
//
//        int minx = Math.max(x1, x3);
//        int miny = Math.max(y1, y3);
//        int maxx = Math.min(x2, x4);
//        int maxy = Math.min(y2, y4);
//
//        if (minx > maxx || miny > maxy)
//            System.out.println(1);
//        else
//            System.out.println(-1);
    }
}
